package com.css.fxfzaqbz.modules.data.service.impl;

import com.css.fxfzaqbz.constants.YNEnum;
import com.css.fxfzaqbz.modules.data.entity.DisposeExport;
import com.css.fxfzaqbz.modules.data.repository.DisposeExportRepository;
import com.css.fxfzaqbz.modules.data.repository.DisposeLabelRepository;
import com.css.fxfzaqbz.modules.data.service.DisposeExportService;
import com.css.fxfzaqbz.util.PlatformDateUtils;
import com.css.fxfzaqbz.util.UUIDGenerator;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.sql.Timestamp;
import java.util.List;


@Service
public class DisposeExportServiceImpl implements DisposeExportService {

    @Resource
    DisposeExportRepository disposeExportRepository;

    @Override
    public List<DisposeExport> saveDisposeExport(List<DisposeExport> disposeExports) {
        for (DisposeExport disposeExport : disposeExports) {
            disposeExport.setExportId(UUIDGenerator.getUUID());
            disposeExport.setDelFlag(YNEnum.Y.toString());
            disposeExport.setCreateTime(PlatformDateUtils.getCurrentTimestamp());
        }
        return disposeExportRepository.saveDisposeExport(disposeExports);
    }

    @Override
    public List<DisposeExport> getDisposeExport(String id) {
        return disposeExportRepository.getDisposeExport(id);
    }

    @Override
    public void delDisposeExport(List<String> ids) {
        Timestamp timestamp = PlatformDateUtils.getCurrentTimestamp();
        disposeExportRepository.delDisposeExport(ids,timestamp);
    }
}
